<%@ page language="java" pageEncoding="UTF-8" %>
<% 
    String context = request.getContextPath();
    request.setAttribute("context",context);
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>文件上传管理</title>
    <link href="${context}/static/jquery-easyui-1.3.2/themes/gray/easyui.css" rel="stylesheet" type="text/css" />
    <link href="${context}/static/jquery-easyui-1.3.2/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="${context}/static/jquery-easyui-1.3.2/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="${context}/static/jquery-easyui-1.3.2/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="${context}/static/jquery-easyui-1.3.2/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="${context}/static/scripts/json2.js" type="text/javascript"></script>
    <script src="${context}/static/scripts/common.js" type="text/javascript"></script> 
    <style type="text/css">
        body {
            padding: 0px;
            margin: 0px;
        }
    </style>
    <script type="text/javascript">
    	var appid="";
    
    
    	function test() {
    	
    		alert("sdfsdfsdaf");
    	}
    
        $(document).ready(function () {
            var grid = $("#dataGrid");
            grid.datagrid({
		        fit: true,
		        nowrap: true,
		        fitColumns: true,
		        rownumbers: true,
		        singleSelect: false,
		        striped: true,
		        pagination:true,
                columns: [[{"field":"id","hidden":true,"width":80,"title":"主键","align":"left"},
                {"field":"appid","hidden":true,"width":80,"title":"应用主键","align":"left"},
                {"field":"upploadfilename","hidden":false,"width":110,"title":"原文件名","align":"left"},
                {"field":"filesavepath","hidden":false,"width":350,"title":"保存的路径","align":"left"},
                {"field":"filesavename","hidden":false,"width":110,"title":"保存名称","align":"left"},
                {"field":"filetype","hidden":false,"width":30,"title":"文件类型","align":"left"},
                {"field":"filesize","hidden":false,"width":30,"title":"文件大小","align":"left"},
                {"field":"createuser","hidden":false,"width":50,"title":"创建人","align":"left"},
                {"field":"createtime","hidden":false,"width":50,"title":"创建时间","align":"left"}]],
                toolbar: [],
                "onDblClickRow": function (rowIndex, rowData) {
                },
                "onClickRow": function (rowIndex, rowData) {
                }
            });
		    //分页控件设置
		    var pager = $("#dataGrid").datagrid("getPager");
		    pager.pagination({
		        onSelectPage: function (pageNumber, pageSize) {
		        	var option = $("#dataGrid").datagrid("options");//确保第二页序号不从1开始
		            option.pageSize = pageSize;
		            option.pageNumber = pageNumber;
		        	var param={};
		            pageNumber = parseInt(pageNumber, 10);
		            pageSize = parseInt(pageSize, 10);
		            param.page=pageNumber;
		            param.size=pageSize;
		            loadRightGrid(param);
		        }
		    });  
		    //loadRightGrid();
       });
       
		function loadRightGrid(paramPager,appid) {
			if(!appid) this.appid=appid;
			var pager=$("#dataGrid").datagrid("getPager");
			if(!paramPager) paramPager={"page":0,"size":parseInt(pager.pagination("options").pageSize, 10),"appid":appid};
		    $.ajax({
		        url: "${context}/upload/uflist.html",
		        data: paramPager,
		        dataType: "json",
		        type: "GET",
		        async: false,
		        success: function (result) {
		        	var rows=result.rows;
		            $("#dataGrid").datagrid("loadData", { total: result.total, rows: result.rows });
		            $("#dataGrid").datagrid("loaded");
		        }
		    });	
		}  	       
       
    </script>
</head>
<body class="easyui-layout" fit="true">
    <div region="center" style="overflow:hidden">
        <table id="dataGrid" fit="true"></table>
    </div>
</body>
</html>
